package com.sp.scmdb.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.sp.scmdb.common.DomainObject;

/**
 * 
 * 用户管理实体类
 * */
@Entity
@Table(name = "OBJ_USRS")
public class User extends DomainObject{

	/**
	 * 用户名
	 */
	@Column(name = "NAME_USER", nullable = false)
	private String userName;
	
	/**
	 * 密码
	 */
	@Column(name = "PASSWD_USER", nullable = false)
	private String passWord;

	/**
	 * 备注
	 */
	@Column(name = "RMK")
	private String rmk;
	
	/**
	 * 角色ID
	 */ 
	@Column(name = "ID_ROLE")
	private int idRole;
	
	/**
	 * 角色实体类
	 * 
	 * */
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_ROLE", insertable = false, updatable = false)
	@NotFound(action=NotFoundAction.IGNORE) 
	private Role role;

	/**
	 * @return the userName
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * @return the passWord
	 */
	public String getPassWord() {
		return passWord;
	}

	/**
	 * @return the rmk
	 */
	public String getRmk() {
		return rmk;
	}

	/**
	 * @return the idRole
	 */
	public int getIdRole() {
		return idRole;
	}

	/**
	 * @return the role
	 */
	public Role getRole() {
		return role;
	}

	/**
	 * @param userName the userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

	/**
	 * @param passWord the passWord to set
	 */
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	/**
	 * @param rmk the rmk to set
	 */
	public void setRmk(String rmk) {
		this.rmk = rmk;
	}

	/**
	 * @param idRole the idRole to set
	 */
	public void setIdRole(int idRole) {
		this.idRole = idRole;
	}

	/**
	 * @param role the role to set
	 */
	public void setRole(Role role) {
		this.role = role;
	}
	
	



}
